package net.oschina.dajiangnan.wx.process.pay.xmlbean;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import net.oschina.dajiangnan.util.XStreamHelper;
import net.oschina.dajiangnan.wx.util.Signature;


public class XmlBean {

    public String toString(){
        return XStreamHelper.toXml(this).replaceAll("__", "_");
    }
    public boolean islegalSign(String apiKey){
        try {
            return Signature.getSign(this,new String[]{"sign"}, apiKey).equals(getSign());
        } catch (IllegalAccessException e) {
            return false;
        }
    }
    
    
    @XStreamAlias("sign")
    protected String sign;
    
    


    public String getSign() {
        return sign;
    }
    public void setSign(String sign) {
        this.sign = sign;
    }
}
